package com.yueqian.sign;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yueqian.sign.model.Classes;
import com.yueqian.sign.model.Course;

import java.util.List;

public class CourseAdapter extends MyAdapter<Course> implements MyAdapter.AdapterListener {

    public CourseAdapter(Context context, List<Course> list) {
        super(context, list);
        setAdapterListener(this);
    }

    @Override
    public View bind(int position, View convertView, ViewGroup parent) {
        if(convertView == null) {
            convertView = LayoutInflater.from(context).inflate(android.R.layout.simple_spinner_item, null);
        }

        item = list.get(position);//不推荐把变量的定义写在循环中
        ((TextView)convertView).setText(item.getName());

        return convertView;
    }
}
